import { EntityModel } from '@midwayjs/orm';
import { Column, PrimaryGeneratedColumn } from 'typeorm';

@EntityModel({
  name: 'group',
})
export class GroupEntity {
  @PrimaryGeneratedColumn({
    type: 'bigint',
    comment: '主键id',
  })
  id: number;

  @Column({
    type: 'int',
    name: 'group_number',
    nullable: false, // 不能为null
    comment: '群号',
  })
  groupNumber: number;

  @Column({
    type: 'int',
    name: 'user_id',
    nullable: false, // 不能为null
    comment: '创建群人用户id',
  })
  userId: number;

  @Column({
    type: 'varchar',
    nullable: false, // 不能为null
    comment: '群名称',
  })
  name: string;

  @Column({
    type: 'varchar',
    nullable: false, // 不能为null
    comment: '群头像',
  })
  imgUrl: string;

  @Column({
    type: 'varchar',
    nullable: false, // 不能为null
    default: '',
    comment: '群备注',
  })
  note: string;

  @Column({
    type: 'varchar',
    nullable: false, // 不能为null
    default: '',
    comment: '群公告',
  })
  notice: string;

  @Column({
    type: 'varchar',
    name: 'create_time',
    nullable: false, // 不能为null
    comment: '群创建时间',
  })
  createTime: string;
}
